/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sdd.facades.factories;

import com.sdd.entities.Customer;
import com.sdd.plains.CustomerPlain;
import java.util.Iterator;
import java.util.List;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;

/**
 *
 * @author T
 */
@Stateless
@LocalBean
public class CustomerFactoryFacadeBean {

    public CustomerPlain createCustomerPlain(Customer c) {
        if (c != null) {
            CustomerPlain cp = new CustomerPlain();
            cp.setId(c.getId());
            cp.setEmail(c.getEmail());
            cp.setFirstname(c.getFirstname());
            cp.setLastname(c.getLastname());
            cp.setLogin(c.getLogin());
            cp.setPass(c.getPass());
            return cp;
        } else {
            return null;
        }
    }

    public List<CustomerPlain> createListCustomerPlain(List<Customer> lc) {
        if (lc != null) {
            Iterator<Customer> it = lc.iterator();
            List<CustomerPlain> lcp = null;
            while (it.hasNext()) {
                lcp.add(createCustomerPlain(it.next()));
            }
            return lcp;
        } else {
            return null;
        }
    }
}
        